#ifndef ASTAR_SEARCH_H
#define ASTAR_SEARCH_H

#include "Graph.h"
#include "NodePriorityQueue.h"
#include <math.h>

class AStar
{
public:
	AStar(Graph& G, int So, int T) : m_Graph(G), m_Source(So), m_Target(T), m_Open(G.GetNumNodes(),GraphEdge(-1,-1)), m_Closed(G.GetNumNodes(),GraphEdge(-1,-1)), m_GCost(G.GetNumNodes(),0), m_FCost(G.GetNumNodes(),0), m_PQ(m_FCost)
	{
		Search();
	}

	std::list<int> Path();
	double GetCost();
	

private:
	int m_Target;
	int m_Source;
	Graph& m_Graph;
	NodePriorityQueue m_PQ;
	std::vector<GraphEdge> m_Open;
	std::vector<GraphEdge> m_Closed;
	std::vector<double> m_FCost;
	std::vector<double> m_GCost;

	float Heuristic(int n1, int n2);
	void Search();
};

#endif